package com.jhx.video.service

import com.jhx.common.http.HttpResponse
import com.jhx.common.model.Photos
import com.jhx.video.model.Bonus
import com.jhx.video.model.CommentDetail
import com.jhx.video.model.VideoArray
import com.jhx.video.model.VideoDetail
import retrofit2.Call
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

/**
 *
 *
 * @author Jack 2018-03-07 18:26
 */
interface VideoService {

    /**
     * 发布视频
     *
     * @param desc 视频描述
     * @param videoId 腾讯云返回的id
     * @param videoUrl 视频地址
     * @param time 视频时长
     */
    @FormUrlEncoded
    @POST("businessCenter/publishSmallVideo")
    fun postVideo(@Field("context") desc: String,
                  @Field("videoUrl") videoUrl: String,
                  @Field("coverUrl") coverUrl: String,
                  @Field("file_id") videoId: String,
                  @Field("vTime") time: String): Call<HttpResponse<Bonus>>

    /**
     * 获取商家相册列表
     */
    @FormUrlEncoded
    @POST("businessCenter/getBusinessAlbumList")
    fun getPhotos(@Field("nowPage") nowPage: String,
                  @Field("pageSize") pageSize: String): Call<HttpResponse<Photos>>

    /**
     * 获取签名
     */
    @FormUrlEncoded
    @POST("businessCenter/txsign")
    fun getSignature(@Field("Nothing") nothing: String? = null): Call<HttpResponse<Any>>

    /**
     * 获取视频列表
     */
    @FormUrlEncoded
    @POST("businessCenter/getShortVideoList")
    fun getVideoList(@Field("pageIndex") pageIndex: Int = 1,
                     @Field("pageSize") pageSize: Int = 10): Call<HttpResponse<VideoArray>>

    /**
     * 置顶视频
     */
    @FormUrlEncoded
    @POST("businessCenter/updateVideoToTop")
    fun stickVideo(@Field("vid") vid: String,
                   @Field("isTop") isTop: Int): Call<HttpResponse<Any>>

    /**
     * 删除视频
     */
    @FormUrlEncoded
    @POST("businessCenter/delVideo")
    fun deleteVideo(@Field("vid") vid: String): Call<HttpResponse<Any>>

    /**
     * 回复评论
     *
     * @param id 评论id
     * @param text 回复内容
     */
    @FormUrlEncoded
    @POST("businessCenter/replyComment")
    fun replyComment(@Field("id") id: String,
                     @Field("text") text: String): Call<HttpResponse<Any>>

    /**
     * 获取评论
     */
    @FormUrlEncoded
    @POST("businessCenter/videoCommentInfos")
    fun getComment(@Field("vid") vid: String,
                   @Field("pageIndex") pageIndex: Int = 1,
                   @Field("pageSize") pageSize: Int = 10): Call<HttpResponse<VideoDetail>>

    /**
     * 所有评论列表
     */
    @FormUrlEncoded
    @POST("businessCenter/videoCommentList")
    fun getAllComment(@Field("commentType") commentType: Int,
                      @Field("pageIndex") pageIndex: Int,
                      @Field("pageSize") pageSize: Int): Call<HttpResponse<List<CommentDetail>>>
}